//
//  MoreCollectionViewCell.m
//  GOGOTravel
//
//  Created by dllo on 16/3/6.
//  Copyright © 2016年 果果. All rights reserved.
//

#import "MoreCollectionViewCell.h"
#import "CityModel.h"

@implementation MoreCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return  self;
}

- (void)createSubView{
    
    self.imageView1 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageView1];
    [_imageView1 release];
    
    
    self.label = [[UILabel alloc] init];
    
    [self.contentView addSubview:_label];
    [_label release];
}

- (void)setModel:(CityModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:_model.cover] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _label.text = _model.name;
    
    
    
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    _imageView1.frame = CGRectMake(2, 2, layoutAttributes.frame.size.width - 4, layoutAttributes.frame.size.height - 4);
    _imageView1.layer.cornerRadius = 10;
    _imageView1.layer.masksToBounds = YES;
    
    _label.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width / 2, 100);
    _label.center = _imageView1.center;
    _label.textAlignment  = NSTextAlignmentCenter;
    _label.font = [UIFont systemFontOfSize:30];
    _label.textColor = [UIColor whiteColor];
}


- (void)dealloc{
    [_imageView1 release];
    [_label release];
    [_model release];
    [super dealloc];
}




@end
